package com.swind.fast.modules.app.railway.permission.service.impl;

import com.swind.fast.common.system.base.service.impl.SwindServiceImpl;
import com.swind.fast.modules.app.railway.permission.entity.RailwayPermission;
import com.swind.fast.modules.app.railway.permission.entity.RailwayRolePermission;
import com.swind.fast.modules.app.railway.permission.mapper.RailwayPermissionMapper;
import com.swind.fast.modules.app.railway.permission.service.IRailwayPermissionService;
import org.springframework.stereotype.Service;

import com.swind.fast.modules.app.railway.permission.vo.RailwayPermModel;
import com.swind.fast.modules.app.railway.permission.mapper.RailwayRolePermissionMapper;

import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.stream.Collectors;

import lombok.extern.slf4j.Slf4j;

/**
 * @Description: 项目
 */
@Slf4j
@Service
public class RailwayPermissionServiceImpl extends SwindServiceImpl<RailwayPermissionMapper, RailwayPermission> implements IRailwayPermissionService {

    public Map<String, List<RailwayPermModel>> queryAllPermItems() {
        List<RailwayPermModel> list = baseMapper.getAllPermItems();

        // Map<String, List<Article>> byAuthor = articles.stream().collect(Collectors.groupingBy(Article::getAuthor));

        Map<String, List<RailwayPermModel>> railwayPermGroup = list.stream().collect(Collectors.groupingBy(RailwayPermModel::getPosition));

        log.info("ls: {}", railwayPermGroup);

        return railwayPermGroup;
    }

}
